package mybatis.mapper;

import mybatis.Utill.batisUtill;
import mybatis.pojo.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.junit.Test;

public class UserMapper {
    @Test
    public void testMethod(){
        SqlSession session = batisUtill.getSession();
        mybatis.mybatisMapper.UserMapper userMapper = session.getMapper(mybatis.mybatisMapper.UserMapper.class);
        //当要给代理对象中的方法传递多个参数时，会出现BindingExcepetion 即绑定错误，显示Parameter'XXX'not found 即参数找不到
        //这是因为当多参数方法时mybatis会自动将每个参数封装成为名为“0”，“1”，“2”......“n”或者“param1”，“param2”......“paramN"等数据对象
        //此为顺序传参法，有多少个参数就在映射文件中按照顺序写多少个数字或者paramN
//        userMapper.registerUser("k","123456");
//        System.out.println(userMapper.selectInfoByUsername("s"));
//        System.out.println(userMapper.selectInfoByAge(10));
//        System.out.println(userMapper.testSelect(1015,"k"));
        System.out.println(userMapper.selectUserByAge(20));
    }
}
